<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('用户添加')" />
</head>
<body>
	<section class="content">
		<form class="form-horizontal" id="userForm">
			<div class="form-group">
				<label class="col-sm-3 control-label">用户名 <span
					style="color: red">*</span>:
				</label>
				<div class="col-sm-8">
					<input name="username" class="form-control" min="3" require="必填项" autocomplete="new-password">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">密码 <span
					style="color: red">*</span>:
				</label>
				<div class="col-sm-8">
					<input name="password" type="password" class="form-control" min="3" require="必填项" autocomplete="new-password">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">确认密码 <span
					style="color: red">*</span>:
				</label>
				<div class="col-sm-8">
					<input name="confirmPassword" type="password" class="form-control" min="3" require="必填项" autocomplete="new-password">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">邮箱 :</label>
				<div class="col-sm-8">
					<input name="email" class="form-control" >
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">电话 :</label>

				<div class="col-sm-8">
					<input name="phone" class="form-control">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">性别 :</label>
				<div class="col-sm-8">
					<select name="sex" class="form-control">
						<option value="0">请选择</option>
						<option value="1">男</option>
						<option value="2">女</option>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">年龄 :</label>
				<div class="col-sm-8">
					<input name="age" class="form-control">
				</div>
			</div>
		</form>
	</section>
	<th:block th:include="include :: footer" />
	<script type="text/javascript">
		function submitHandler() {
			if (doValidForm(userForm)) {
				$.common.postAjax("/user/doAdd", $("#userForm").serialize(), 
					function(data) {
						if (data.status == 200) {
							parent.layer.closeAll('iframe'); // 关闭当前frame
							parent.$.table.refreshTable();
							parent.toastr.success(data.msg);
						} else {
							parent.toastr.error(data.msg);
						}
					}
				)
			}
		}
	</script>
</body>
</html>